package com.ruoyi.web.tdmdata.common;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.tdmdata.domain.TdmYaoWuShouTi;
import com.ruoyi.web.tdmdata.service.ITdmYaoWuShouTiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 皮肤病 Controller
 * Dermatosis
 * @author ly
 * @date 2022-03-14
 */
@RestController
@RequestMapping("/tdmdata/TdmYaoWuShouTiDermatosis")
public class TdmYaoWuShouTiDermatosisController extends BaseController
{
    @Autowired
    private ITdmYaoWuShouTiService tdmYaoWuShouTiService;

    /**
     * 查询ID-09 -22 药物受体列表
     */
    //@PreAuthorize("@ss.hasPermi('tdmdata:TdmYaoWuShouTi:list')")
    @GetMapping("/list")
    public TableDataInfo list(TdmYaoWuShouTi tdmYaoWuShouTi)
    {
        startPage();
        List<TdmYaoWuShouTi> list = tdmYaoWuShouTiService.selectTdmYaoWuShouTiDermatosisList(tdmYaoWuShouTi);
        return getDataTable(list);
    }

    /**
     * 导出ID-09 -22 药物受体列表
     */
    // @PreAuthorize("@ss.hasPermi('tdmdata:TdmYaoWuShouTi:export')")
    @Log(title = "ID-09 -22 药物受体", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TdmYaoWuShouTi tdmYaoWuShouTi)
    {
        List<TdmYaoWuShouTi> list = tdmYaoWuShouTiService.selectTdmYaoWuShouTiList(tdmYaoWuShouTi);
        ExcelUtil<TdmYaoWuShouTi> util = new ExcelUtil<TdmYaoWuShouTi>(TdmYaoWuShouTi.class);
        util.exportExcel(response, list, "ID-09 -22 药物受体数据");
    }

    /**
     * 获取ID-09 -22 药物受体详细信息
     */
    //@PreAuthorize("@ss.hasPermi('tdmdata:TdmYaoWuShouTi:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tdmYaoWuShouTiService.selectTdmYaoWuShouTiById(id));
    }

    /**
     * 新增ID-09 -22 药物受体
     */
    //@PreAuthorize("@ss.hasPermi('tdmdata:TdmYaoWuShouTi:add')")
    @Log(title = "ID-09 -22 药物受体", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TdmYaoWuShouTi tdmYaoWuShouTi)
    {
        return toAjax(tdmYaoWuShouTiService.insertTdmYaoWuShouTiDermatosis(tdmYaoWuShouTi));
    }

    /**
     * 修改ID-09 -22 药物受体
     */
    // @PreAuthorize("@ss.hasPermi('tdmdata:TdmYaoWuShouTi:edit')")
    @Log(title = "ID-09 -22 药物受体", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TdmYaoWuShouTi tdmYaoWuShouTi)
    {
        return toAjax(tdmYaoWuShouTiService.updateTdmYaoWuShouTi(tdmYaoWuShouTi));
    }

    /**
     * 删除ID-09 -22 药物受体
     */
    // @PreAuthorize("@ss.hasPermi('tdmdata:TdmYaoWuShouTi:remove')")
    @Log(title = "ID-09 -22 药物受体", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tdmYaoWuShouTiService.deleteTdmYaoWuShouTiByIds(ids));
    }
}
